<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>16-样式绑定之style绑定用法</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style></style>
  </head>
  <body>
    <div id="app">
      <div
        class="box"
        v-bind:style="{border: objBorder, width:objWidth, height:objHeight}"
      >
        盒子1
      </div>
      <div v-bind:style="objSty1">盒子2</div>
      <div v-bind:style="[objSty1, objSty2]">盒子3</div>

      <button @click="btn">点击改变</button>
    </div>
    <script>
      Vue.config.keyCodes.hello = 65; // 65表示a， 只有按下a才会触发
      var vm = new Vue({
        el: '#app',
        data: {
          objBorder: '2px solid red',
          objWidth: '100px',
          objHeight: '100px',
          objSty1: {
            border: '5px solid blue',
            width: '200px',
            height: '200px',
          },
          objSty2: {
            backgroundColor: 'deeppink',
          },
        },
        methods: {},
      });
    </script>
  </body>
</html>
